import request from '@/config/axios'
import type { Dayjs } from 'dayjs';

/** 闸机卡片信息 */
export interface DeviceGateCard {
          id: number; // 编号
          cardNumber?: string; // 卡号
          schoolCode?: string; // 所属园区
          classId?: number; // 班级ID
          studentId?: number; // 学生ID
          studentName: string; // 学生姓名
          sort?: number; // 排序
          status?: number; // 状态
  }

// 闸机卡片 API
export const DeviceGateCardApi = {
  // 查询闸机卡片分页
  getDeviceGateCardPage: async (params: any) => {
    return await request.get({ url: `/school/device-gate-card/page`, params })
  },

  // 查询闸机卡片详情
  getDeviceGateCard: async (id: number) => {
    return await request.get({ url: `/school/device-gate-card/get?id=` + id })
  },

  // 新增闸机卡片
  createDeviceGateCard: async (data: DeviceGateCard) => {
    return await request.post({ url: `/school/device-gate-card/create`, data })
  },

  // 修改闸机卡片
  updateDeviceGateCard: async (data: DeviceGateCard) => {
    return await request.put({ url: `/school/device-gate-card/update`, data })
  },

  // 删除闸机卡片
  deleteDeviceGateCard: async (id: number) => {
    return await request.delete({ url: `/school/device-gate-card/delete?id=` + id })
  },

  /** 批量删除闸机卡片 */
  deleteDeviceGateCardList: async (ids: number[]) => {
    return await request.delete({ url: `/school/device-gate-card/delete-list?ids=${ids.join(',')}` })
  },

  // 导出闸机卡片 Excel
  exportDeviceGateCard: async (params) => {
    return await request.download({ url: `/school/device-gate-card/export-excel`, params })
  },
}